//
//  FOGoodTModel.swift
//
//  Created by 邱仙凯 on 2021/9/22
//  Copyright (c) . All rights reserved.
//

import Foundation
import ObjectMapper

public struct ZyaFOGoodTModel: Mappable {

  // MARK: Declaration for string constants to be used to decode and also serialize.
  private struct SerializationKeys {
    static let sSecTypeName = "s_sec_type_name"
    static let sSecRatio = "s_sec_ratio"
    static let sCode = "s_code"
    static let sWeightRatio = "s_weight_ratio"
    static let sGoodsId = "s_goods_id"
    static let sPricePrint = "s_price_print"
    static let sSecTypeCode = "s_sec_type_code"
    static let sUnitId = "s_unit_id"
    static let sVolume = "s_volume"
    static let sPriceMin = "s_price_min"
    static let sName = "s_name"
    static let sSecUnitId = "s_sec_unit_id"
    static let sSpec = "s_spec"
    static let sPrice = "s_price"
    static let sStandard = "s_standard"
    static let sSaleUnitNm = "s_sale_unit_nm"
    static let sTypeCode = "s_type_code"
    static let sMark = "s_mark"
    static let sSecUnitName = "s_sec_unit_name"
    static let sUnitName = "s_unit_name"
    static let sSaleUnit = "s_sale_unit"
    static let sStandardGoods = "s_standard_goods"
    static let sTypeName = "s_type_name"
    static let sTax = "s_tax"
      static let sAppGoodsNm = "s_app_goods_nm"
      static let sCompanyGoodsTreeNm = "s_company_goods_tree_nm"
  }

  // MARK: Properties
  public var sSecTypeName: String?
  public var sSecRatio: Int?
  public var sCode: String?
  public var sWeightRatio: String?
  public var sGoodsId: String?
  public var sPricePrint: String?
  public var sSecTypeCode: String?
  public var sUnitId: Int?
  public var sVolume: String?
  public var sPriceMin: String?
  public var sName: String?
  public var sSecUnitId: Int?
  public var sSpec: String?
  public var sPrice: String?
  public var sStandard: String?
  public var sSaleUnitNm: String?
  public var sTypeCode: String?
  public var sMark: String?
  public var sSecUnitName: String?
  public var sUnitName: String?
  public var sSaleUnit: String?
  public var sStandardGoods: Int?
  public var sTypeName: String?
  public var sTax: String?
    public var selectX = false
    public var sAppGoodsNm: String?
    public var sCompanyGoodsTreeNm: String?
  // MARK: ObjectMapper Initializers
  /// Map a JSON object to this class using ObjectMapper.
  ///
  /// - parameter map: A mapping from ObjectMapper.
  public init?(map: Map){

  }

  /// Map a JSON object to this class using ObjectMapper.
  ///
  /// - parameter map: A mapping from ObjectMapper.
  public mutating func mapping(map: Map) {
    sSecTypeName <- map[SerializationKeys.sSecTypeName]
    sSecRatio <- map[SerializationKeys.sSecRatio]
    sCode <- map[SerializationKeys.sCode]
    sWeightRatio <- map[SerializationKeys.sWeightRatio]
    sGoodsId <- (map[SerializationKeys.sGoodsId],StringTransform())
    sPricePrint <- map[SerializationKeys.sPricePrint]
    sSecTypeCode <- map[SerializationKeys.sSecTypeCode]
    sUnitId <- map[SerializationKeys.sUnitId]
    sVolume <- map[SerializationKeys.sVolume]
    sPriceMin <- map[SerializationKeys.sPriceMin]
    sName <- map[SerializationKeys.sName]
    sSecUnitId <- map[SerializationKeys.sSecUnitId]
    sSpec <- map[SerializationKeys.sSpec]
    sPrice <- (map[SerializationKeys.sPrice],StringTransform_test())
    sStandard <- map[SerializationKeys.sStandard]
    sSaleUnitNm <- map[SerializationKeys.sSaleUnitNm]
    sTypeCode <- map[SerializationKeys.sTypeCode]
    sMark <- map[SerializationKeys.sMark]
    sSecUnitName <- map[SerializationKeys.sSecUnitName]
    sUnitName <- map[SerializationKeys.sUnitName]
    sSaleUnit <- (map[SerializationKeys.sSaleUnit],StringTransform())
    sStandardGoods <- map[SerializationKeys.sStandardGoods]
    sTypeName <- map[SerializationKeys.sTypeName]
    sTax <- (map[SerializationKeys.sTax],StringTransform_test())
      sAppGoodsNm <- (map[SerializationKeys.sAppGoodsNm],StringTransform())
      sCompanyGoodsTreeNm <- (map[SerializationKeys.sCompanyGoodsTreeNm],StringTransform())
  }

  /// Generates description of the object in the form of a NSDictionary.
  ///
  /// - returns: A Key value pair containing all valid values in the object.
  public func dictionaryRepresentation() -> [String: Any] {
    var dictionary: [String: Any] = [:]
    if let value = sSecTypeName { dictionary[SerializationKeys.sSecTypeName] = value }
    if let value = sSecRatio { dictionary[SerializationKeys.sSecRatio] = value }
    if let value = sCode { dictionary[SerializationKeys.sCode] = value }
    if let value = sWeightRatio { dictionary[SerializationKeys.sWeightRatio] = value }
    if let value = sGoodsId { dictionary[SerializationKeys.sGoodsId] = value }
    if let value = sPricePrint { dictionary[SerializationKeys.sPricePrint] = value }
    if let value = sSecTypeCode { dictionary[SerializationKeys.sSecTypeCode] = value }
    if let value = sUnitId { dictionary[SerializationKeys.sUnitId] = value }
    if let value = sVolume { dictionary[SerializationKeys.sVolume] = value }
    if let value = sPriceMin { dictionary[SerializationKeys.sPriceMin] = value }
    if let value = sName { dictionary[SerializationKeys.sName] = value }
    if let value = sSecUnitId { dictionary[SerializationKeys.sSecUnitId] = value }
    if let value = sSpec { dictionary[SerializationKeys.sSpec] = value }
    if let value = sPrice { dictionary[SerializationKeys.sPrice] = value }
    if let value = sStandard { dictionary[SerializationKeys.sStandard] = value }
    if let value = sSaleUnitNm { dictionary[SerializationKeys.sSaleUnitNm] = value }
    if let value = sTypeCode { dictionary[SerializationKeys.sTypeCode] = value }
    if let value = sMark { dictionary[SerializationKeys.sMark] = value }
    if let value = sSecUnitName { dictionary[SerializationKeys.sSecUnitName] = value }
    if let value = sUnitName { dictionary[SerializationKeys.sUnitName] = value }
    if let value = sSaleUnit { dictionary[SerializationKeys.sSaleUnit] = value }
    if let value = sStandardGoods { dictionary[SerializationKeys.sStandardGoods] = value }
    if let value = sTypeName { dictionary[SerializationKeys.sTypeName] = value }
    if let value = sTax { dictionary[SerializationKeys.sTax] = value }
      if let value = sAppGoodsNm { dictionary[SerializationKeys.sAppGoodsNm] = value }
      if let value = sCompanyGoodsTreeNm { dictionary[SerializationKeys.sCompanyGoodsTreeNm] = value }
    return dictionary
  }

}

struct ZyaFOGoodType: Mappable {
    
    var s_type_name:String?
    var s_type_code:String?
    var s_sec:[ZyaFOGoodSecType]?
    init?(map: Map) {
        
    }
    // Mappable
    mutating func mapping(map: Map) {
        s_type_name <-  (map["s_type_name"],StringTransform())
        s_type_code <-  map["s_type_code"]
        s_sec <-  map["sec_type"]

    }
}
 
struct ZyaFOGoodSecType: Mappable {
    
    var s_sec_type_name:String?
    var s_sec_type_code:String?
    var s_type_code:String?
    init?(map: Map) {
        
    }
    // Mappable
    mutating func mapping(map: Map) {
        s_sec_type_name <-  (map["s_sec_type_name"],StringTransform())
        s_sec_type_code <-  map["s_sec_type_code"]
        s_type_code <-  map["s_type_code"]

    }
}
 
struct ZyaFOGoodTPre: Mappable {
    
    var s_sec_type_code:String?
    var goods:[ZyaFOGoodTModel]?
 
    init?(map: Map) {
        
    }
    // Mappable
    mutating func mapping(map: Map) {
        s_sec_type_code <-  (map["s_sec_type_code"],StringTransform())
        goods <-  map["goods"]
       
    }
}
